package com.example.c5;

import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.util.NettyRuntime;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
 * @author Jonathan
 * 2021/5/31 23:57
 */
@Slf4j
public class EventLoopDemo {

    public static void main(String[] args) {
        log.info("hello world");
//        log.info("hello world:%s");
        log.info("hshs");
        NioEventLoopGroup group = new NioEventLoopGroup();
        log.info("{}", NettyRuntime.availableProcessors());
        group.submit(() -> {
            log.info("hello world");
        });
        System.out.println(group.next());
        System.out.println(group.next());
        System.out.println(group.next());
        group.next().scheduleAtFixedRate(() -> {
            log.info("ok:{}", "hello");
        }, 1, 1, TimeUnit.SECONDS);
    }
}
